/* Copyright 2001,2002,2003 NAH6 BV
 * All Rights Reserved
 *
 *  $Header: /var/lib/cvs/secphone/ui/windows/nhThread.h,v 1.4 2003/11/21 12:39:24 itsme Exp $
 *
 *
 */


#ifndef __NHTHREAD_H__

#include <windows.h>

class NHThread {
public:
    NHThread();
    virtual ~NHThread();

    virtual void StartThread(HANDLE hEvStarted = INVALID_HANDLE_VALUE );

    bool Started() const;
    bool Terminated() const;
    bool Running() const;

    HANDLE Handle() const;
    
    virtual const char* name() const { return "undefined"; }

protected:
    virtual DWORD ThreadProc()=0;

private:
    HANDLE m_hThread;
    DWORD m_nThreadId;
    HANDLE m_hStartEvent;
    HANDLE m_hEventStarted;

    bool m_bStarted;
    bool m_bTerminated;

    static DWORD MainThreadProc(NHThread *t);
    DWORD NHThread::ThreadObjectProc();

};

#define __NHTHREAD_H__
#endif

